package com.example.exception;

import com.example.common.AjaxResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常处理器
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler
    public AjaxResult handleException(Exception e){
        e.printStackTrace();
        return AjaxResult.fail(e.getMessage());
    }


}
